Xbasic

A5_RefreshPassiveLinkTable Function

Syntax

Result as P = a5_RefreshPassiveLinkTable(C tablename [,L FlagreportResults [,L promptForOverwrite [,* arguments [,* otherOptions [,* openConnection [,L suppressErrorMessages [,L showProgress [,L allowCancel ]]]]]]]])

Arguments

Result

A dot variable that describes the result of the operation.

Element

Type and Description

.error

L, .T. indicates that an error occurred

.errorText

C, A text description of any error that occurred.

tablename

The name of the table to refresh. The path of the current database is assumed.

FlagreportResults

Logical. Optional. Default = .F. .T. = If an error occurred, displays a message that tells you what the error was. .F. = No error reporting.

promptForOverwrite

Logical. Optional. Default = .T. .T. = displays a message that warns you that you are about to delete the current table's contents. .F. = no prompt.

arguments

Optional. Default = NULL_VALUE(). Arguments that retrieve value(s) from variable(s) or prompts for value(s) at runtime. Only applicable to SQL Reports. Refer to SQL::Arguments Object.

otherOptions

Optional. Default = NULL_VALUE(). Sets filter (WHERE) and order (ORDER BY) expressions for a query against a passive-linked table. A pointer dot variable with 2 elements. Refer to Using the Options Argument.

ElementTypeDescription
.filterCAdds to the WHERE clause in the underlying SQL expression.
.orderCReplaces the ORDER BY clause in the underlying SQL expression.
openConnection

*

suppressErrorMessages

Logical

showProgress

Logical

allowCancel

Logical

Description

The A5_RefreshPassiveLinkTable() function deletes the data in a passive-linked table, then retrieves its records from the specified SQL data source.

Example

? A5_RefreshPassiveLinkTable("northwindproducts", .t., .t.)
= error = .F.
errorText = ""

? A5_RefreshPassiveLinkTable("customer", .f., .t.)
= error = .T.
errorText = "Table is not a Passively Linked Table."

This script refreshes all passive link tables.

dim tableList as C
dim count as N
dim i as N
dim pr as P
dim table_i as C

tableList = <<%txt%
pl_cust
pl_customes
pl_vendor%txt%

count = line_count(tableList)

for i = 1 to (count)
    table_i = word(tableList,i,crlf())
    pr =a5_RefreshPassiveLinkTable(table_i,.f.,.f.)
    if pr.error = .t. then
        ui_msg_box("Error","Table data was not refreshed: '" + table_i + "'." + crlf(3) + "Error reported was: " + crlf() + pr.errorText, UI_STOP_SYMBOL)
    end if           
next i

Limitations

Desktop applications only.

See Also